Component({
  properties: {
    userTags: {
      default: [],
      type: Array
    },
    animationData: {
      default: '这里是自定义组件',
      type: String
    }
  },
  data: {
    imgheights: [],
    current: 0,
    dots: []
  },
  created () {
  },
  ready () {
    let dots = []
    this.data.userTags.map((v, k) => {
      let classname = k === 0 ? 'active' : ''
      dots.push({
        class: classname
      })
    })
    this.setData({
      dots: dots
    })
  },
  methods: {
    bannerNavigate(event) {
      let current = event.currentTarget.dataset
      wx.navigateTo({
        url: '/pages/middlewave/middlewave?href=' + encodeURIComponent(current.url),
        success: function(res) {},
        fail: function(res) {},
        complete: function(res) {},
      })
    },
    bindchange(event) {
      let current = event.detail.current
      this.setData({
        current: current
      })
      let dots = []
      this.data.dots.map((v, k) => {
        if (k === current) {
          v.class = 'active'
        }
        else {
          v.class = ''
        }
        dots.push(v)
      })
      this.setData({
        dots: dots
      })
    },
    imageLoad(e) {
      var imgwidth = e.detail.width,
        height = e.detail.height, 
        imgheight = height / imgwidth * 750;
        var imgheights = this.data.imgheights
        imgheights.push(imgheight)
        this.setData({
          imgheights: imgheights,
        })  
    },
  }
})